package main

import (
	"fmt"
	"runtime"
	"sync"
)

func mydefer() {
	defer func() {
		if err := recover(); err != nil {
			fmt.Println(err)
		}
	}()
	defer fmt.Println("打印钱")
	defer fmt.Println("打印中")
	defer fmt.Println("打印后")

	panic("error")
	fmt.Println("pannnnnnn")
}

type Man struct {
	Name string
}

func loopMan() {
	mp := make(map[string]*Man)
	mans := []Man{
		{Name: "z1"},
		{Name: "z2"},
		{Name: "z3"},
	}
	//for _, item := range mans {
	//	mp[item.Name] = &item
	//}
	for i := 0; i < len(mans); i++ {
		mp[mans[i].Name] = &mans[i]
	}
	fmt.Println(mp)

}
func main() {
	runtime.GOMAXPROCS(1)
	var wg sync.WaitGroup
	wg.Add(20)
	for i := 0; i < 10; i++ {
		go func() {
			fmt.Println("i====", i)
			wg.Done()
		}()
	}
	for i := 10; i < 20; i++ {
		go func(i int) {
			fmt.Println("i=====>>", i)
			wg.Done()
		}(i)
	}
	wg.Wait()
}
